1. Technical Field
The present invention is directed to resource allocations in a computer system. More specifically, the present invention is directed to a method and apparatus of load balancing resources of a computer system in accordance with certain constraints or use-policies set by a system administrator.
2. Description of Related Art
At any given processing time, there may be a multiplicity of user processes or threads waiting to be executed on a processor or CPU of a computing system. To best utilize the CPU of the system then, it is necessary that an efficient mechanism that properly queues the processes or threads for execution be used. The mechanism used by most computer systems to accomplish this task is a scheduler.
Note that a process is a program. When a program is executing, it is loosely referred to as a task. In most operating systems, there is a one-to-one relationship between a task and a program. However, some operating systems allow a program to be divided into multiple tasks or threads. Such systems are called multithreaded operating systems. For the purpose of simplicity, threads and processes will henceforth be used interchangeably.
A scheduler is a software program that coordinates the use of a computer system's shared resources (e.g., a CPU). The scheduler usually uses an algorithm such as a first-in, first-out (i.e., FIFO), round robin or last-in, first-out (LIFO), a priority queue, a tree etc. algorithm or a combination of a plurality of algorithms in doing so. Basically, if a computer system has three CPUs (CPU1, CPU2 and CPU3), each CPU will accordingly have a ready-to-be-processed queue or run queue. If the algorithm in use to assign processes to the run queue is the round robin algorithm and if the last process created was assigned to the queue associated with CPU2, then the next process created will be assigned to the queue of CPU3. The next created process will then be assigned to the queue associated with CPU1 and so on. Thus, schedulers are designed to give each process a fair share of a computer system's resources.
Sometimes a system administrator may want different processes to receive a different share of a resource. In that case, a workload manager (WLM) is used in conjunction with the scheduler. The WLM assigns a number representing a percentage of time a process may use a resource of a computer system to each process. Each time a process uses the resource, its assigned number is reduced. This scheme allows processes that have a lower assigned number to nonetheless use the resource.
In some instances, this concept is applied to classes of processes. A class of processes, in this case, may be a group of processes that belongs to a particular group of users. Thus, just as in the case where a process is assigned a number, when processes of a class are using the resource, the number assigned to the class is reduced. Again, this scheme is used to ascertain that processes in classes with a lower assigned number do have opportunities to use the resource.
The problem, however, is that at times a two-processor system with, for instance, two classes of processes each having a different assigned number may end up with one processor with one class of processes in its queue while the other processor with the other class of processes in its queue. When this occurs, the two processors of the computer system may not be used as efficiently as they could be or as a system administrator may have intended them to be. Specifically, processes in one run queue will receive more processing time than they are allowed to.
Thus, what is needed is a system, apparatus and method of ascertaining that each queue of a system always contains a mixture of classes of processes, each one having a different assigned number, in order to ensure that processor use-policies established by a system administrator are adhered to.